import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import axios from 'axios'

// 你可以创建一个axios的实例并设置默认配置
const axiosInstance = axios.create({
  baseURL: 'http://110.41.40.83:7997/app', // 设置基础URL
  // baseURL: 'http://localhost:8380/app', // 设置基础URL
  timeout: 30000, // 设置请求超时时间
  withCredentials: false, // 设置跨域请求时是否需要使用凭证
  headers: { // 设置请求头<解决java springboot 接受不到请求参数>
    'Content-Type': 'application/x-www-form-urlencoded'
  }
})

const app = createApp(App)
app.config.globalProperties.$http = axiosInstance
app.use(router).use(ElementPlus).mount('#app')
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
